/*
 *  Copyright (C) 2011 Ryan Sullivan.  Contact: ryan@kayoticlabs.com
 * 
 *  This file is part of kayotic-vkm.
 * 
 *  kayotic-vkm is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  kayotic-vkm is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with kayotic-vkm.  If not, see <http://www.gnu.org/licenses/>.
 */

package client;

import com.sun.awt.AWTUtilities;
import java.awt.Point;
import java.awt.Robot;
import java.awt.Toolkit;
import javax.swing.JWindow;

/**
 *
 * @author Game Slave 2
 */
public class InputWindow extends JWindow {

    public InputWindow() throws Exception{
        super();
        // Get toolkit for screen size
        Toolkit tk = Toolkit.getDefaultToolkit();
        // Set size of window to size of screen
        this.setSize(tk.getScreenSize());
        // Set the cursor to an invisible cursor
        this.setCursor(tk.createCustomCursor(tk.createImage(""), new Point(), null));
        // Force window to top
        this.setAlwaysOnTop(true);
        // Make window transparent
        AWTUtilities.setWindowOpacity(this, Float.valueOf(0.01f));
        // Show window
        this.setVisible(true);
        // Create robot to center mouse
        Robot rob = new Robot();
        // Center mouse on window
        rob.mouseMove(tk.getScreenSize().height/2, tk.getScreenSize().width/2);
        // Create Mouse Listener Class
        mouse mouse = new mouse(this.getMousePosition(), this);
        // Add Mouse Listener and Mouse Motion listener
        this.addMouseListener(mouse);
        this.addMouseMotionListener(mouse);
    }
}
